<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "news_flash".
 *
 * @property integer $id
 * @property string $title
 * @property string $content
 * @property integer $ishot
 * @property integer $status
 * @property integer $up
 * @property integer $userid
 * @property string $username
 * @property string $ptime
 * @property integer $ctime
 * @property integer $mtime
 */
class NewsFlash extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'news_flash';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title','content','ishot','status'], 'required','message' => '{attribute}不能为空！'],
            [['title','content'], 'string'],
            [['ishot', 'status', 'up','userid', 'ctime', 'mtime'], 'integer'],
            [['ptime'], 'safe'],
//            ['ptime', 'compare', 'compareValue' => date("Y-m-d H:i:s",time()), 'operator' => '>','message' => '{attribute}必须大于当前时间！'],
            [['title'], 'string', 'max' => 500],
            [['username'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '标题',
            'content' => '内容',
            'ishot' => '热点',
            'status' => '发布方式',
            'up' => '点赞',
            'userid' => 'Userid',
            'username' => 'Username',
            'ptime' => '发布时间',
            'ctime' => '创建时间',
            'mtime' => '修改时间',
        ];
    }
}
